import java.util.*;

public class Solution {
    Queue<Character> queue = new LinkedList<>();
    Map<Character, Integer> map = new HashMap<>();


    //Insert one char from stringstream
    public void Insert(char ch)
    {
        map.put(ch, map.getOrDefault(ch, 0) + 1);
        if (map.get(ch) == 1) {
            queue.add(ch);
        }
    }
  //return the first appearence once char in current stringstream
    public char FirstAppearingOnce()
    {
        char temp;
        while (!queue.isEmpty()) {
            temp = queue.peek();
            if (map.get(temp) == 1) {
                return temp;
            }
            else {
                queue.remove();
            }
        }
        return '#';
    }
}
